﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using stockUploader.Core;
using System.IO;

namespace stockUploader
{
    public class CheckedStock
    {
        public Stock Stock { get; set; }
        public bool IsChecked { get; set; }
    }

    public class CheckedFileInfo
    {
        public FileInfo FileInfo { get; set; }
        public string Name
        {
            get
            {
                return FileInfo.Name.Remove(FileInfo.Name.Length - FileInfo.Extension.Length);
            }
        }
        public string Extension
        {
            get
            {
                return FileInfo.Extension;
            }
        }
        public bool IsChecked { get; set; }

        public IEnumerable<CheckedFileInfo> SupportingFiles { get; set; }
    }

    public class CheckedFileInfoComparer : IEqualityComparer<CheckedFileInfo>
    {
        #region IEqualityComparer<CheckedFileInfo> Members

        public bool Equals(CheckedFileInfo x, CheckedFileInfo y)
        {
            return x.Name.Equals(y.Name, StringComparison.InvariantCultureIgnoreCase);
        }

        public int GetHashCode(CheckedFileInfo obj)
        {
            return obj.Name.GetHashCode();
        }

        #endregion
    }

}
